#pragma once

namespace HFSME {
namespace detail {


template <typename T>
struct unary_function_traits;
template <typename ClassType, typename ReturnType, typename Arg1>
struct unary_function_traits<ReturnType(ClassType::*)(Arg1)>
{
	typedef ReturnType 	return_type;
	typedef ClassType	class_type;
	typedef Arg1	  	argument_type;
};

template <int v>
struct Int2Type
{
   enum { value = v };
};


#define CREATE_CLASS_HAS_MEMBER_TRAIT(T,ReturnValue,ARG1,Member) \
class class_has_member_##Member											\
{\
	typedef char ArrayOfOne[1];\
	typedef char ArrayOfTwo[2];\
\
	template <typename U, ReturnValue (U::*)(ARG1)> struct Check;\
    template <typename U> static char func(Check<U, &U::Member> *);\
    template <typename U> static int func(...);\
  public:\
    typedef class_has_member_##Member type;\
    enum { value = sizeof(func<T>(0)) == sizeof(char) };\
};



}  // namespace detail
}  // namespace HFSME
